package com.xjtu.platform.security.forgetpassword.dao;

import com.xjtu.platform.security.forgetpassword.ForgetPasswordDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ForgetPasswordDao {

    @Select("select 1 from user where user_id=#{user_id}")
    int checkUser(ForgetPasswordDto dto);

    @Select("select email from user where user_id = #{user_id}")
    String getEmail(ForgetPasswordDto dto);

    @Update("update user set code  = #{code} where user_id = #{user_id}")
    void sendEmail(ForgetPasswordDto dto);

    @Update("update user set user_pwd = #{user_pwd} where user_id = #{user_id}")
    void updatePwd(ForgetPasswordDto dto);


    @Select("select code from user where user_id = #{user_id}")
    String findCode(ForgetPasswordDto dto);
}
